<template>
  <el-container>
    <el-main class="nopadding">
      <el-table ref="table" :data="list" row-key="id" stripe border v-if="type == 1">
        <el-table-column prop="contractName" label="合同名称" min-width="100">
        </el-table-column>
        <el-table-column prop="planMoney" label="应收金额" width="250">
          <template #default="scope">
            <p>{{ scope.row.planMoney }}元</p>
          </template>
        </el-table-column>
        <el-table-column prop="actualPlanMoney" label="实收金额" width="250">
          <template #default="scope">
            <span>{{ scope.row.actualPlanMoney ?? 0 }}元</span>
          </template>
        </el-table-column>
        <el-table-column label="本次收款" prop="auditMoney" width="250">
          <template #default="scope">
            <span>{{ scope.row.money ?? 0 }}元</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center" width="100">
          <template #default="scope">
            <el-button-group>
              <el-button
                text
                type="primary"
                size="small"
                @click="table_showAll(scope.row, scope.$index)"
                >查看合同</el-button
              >
            </el-button-group>
          </template>
        </el-table-column>
      </el-table>
      <el-table ref="table" :data="list" row-key="id" stripe border v-if="type == 3">
        <el-table-column prop="customerName" label="客户名称" min-width="100">
        </el-table-column>
        <el-table-column prop="planMoney" label="本期应收" width="200">
          <template #default="scope">
            <p>{{ scope.row.planMoney }}元</p>
          </template>
        </el-table-column>
        <el-table-column prop="actualPlanMoney" label="本期实收" width="200">
          <template #default="scope">
            <span style="color: green">{{ scope.row.actualPlanMoney ?? 0 }}元</span>
          </template>
        </el-table-column>
        <el-table-column label="本期欠款" prop="balanceMoney" width="200">
          <template #default="scope">
            <span style="color: gold">{{ scope.row.balanceMoney ?? 0 }}元</span>
          </template>
        </el-table-column>
      </el-table>
    </el-main>
  </el-container>
</template>

<script>
export default {
  props: {
    type: {
      type: Number,
      required: true,
      default: 1,
    },
    list: {
      type: Array,
      required: true,
      default: () => [],
    },
  },

  data() {
    return {};
  },
  mounted() {
  },
  methods:{
    table_showAll(row){
      console.error(row)
      this.$router.push({
      path: "/contract/contractManagement/detailList",
      query: {
        id: row.contractId,
      },
    });
    }
  }
};
</script>
<style></style>
